package ru.amse.tsyganov.jumleditor.main;

import org.eclipse.swt.graphics.Image;

import ru.amse.tsyganov.jumleditor.view.preferences.Images;

public enum ChartType {
	ACTIVITY {
		public String[] allowedExtensions() {
			return new String[] {"*.actuml"};
		}
		public Image getImage() {
			return Images.getActivityChartImage();
		}
	},
	COLLABORATION {
		public String[] allowedExtensions() {
			return new String[] {"*.clbuml"};
		}
		public Image getImage() {
			return Images.getCollaborationChartImage();
		}
	}, 
	NONE {
		public String[] allowedExtensions() {
			return new String[] {"*.actuml", "*.clbuml"};
		}
		public Image getImage() {
			return null;
		}
	};
	
	public abstract String[] allowedExtensions();
	
	public abstract Image getImage();
	
	public static ChartType resolveType(String fileName) {
		if (fileName.endsWith("actuml")) {
			return ACTIVITY;
		} else if (fileName.endsWith("clbuml")) {
			return COLLABORATION;
		} else {
			throw new IllegalArgumentException();
		}
	}
}
